import babelpolyfill from 'babel-polyfill'
import Vue from 'vue'
import ElementUI from 'element-ui'
// import 'element-ui/lib/theme-chalk/index.css'
import VueRouter from 'vue-router'
import routes from './router'
import App from './App'

Vue.use(ElementUI);
Vue.use(VueRouter);

const router = new VueRouter({
    mode: "history",
    routes: routes,
    scrollBehavior (to, from, savedPosition) {	
      return { x: 0, y: 0 }
    }
})


// Object.defineProperty(Vue.prototype, 'UPLOADURL', {value: process.env.UPLOAD_URL});
// Object.defineProperty(Vue.prototype, 'BASEURL', {value: process.env.BASE_URL});

// Object.defineProperty(Vue.prototype, 'moment', {value: moment});

// router.beforeEach((to, from, next) => {
//     let jwt = sessionStorage.getItem('jwt');
//     if (!jwt && to.path != '/login') {
//         next({ path: '/login' })
//     } else {
//         next()
//     }
// })

new Vue({
    router: router,
    render: h => h(App)
}).$mount('#app')
